﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BoletoElectronicoDesktop.AbmRol
{
    public partial class FormModificacionRol : Form
    {
        public string rol;

        public FormModificacionRol()
        {
            InitializeComponent();
        }

        private void btnBuscar_Click(object sender, EventArgs e)
        {
            rol = txtRol.Text;
           
            //cargo la datagridview con los resultados
            DataTable DtRoles = RolDAO.FiltrarRoles(rol);
            dataGridView1.DataSource = DtRoles;
            
        }

        private void btnLimpiar_Click(object sender, EventArgs e)
        {
            txtRol.Text = "";
            dataGridView1.DataSource = null;

        }

        private void FormModificacionRol_Load(object sender, EventArgs e)
        {
            //inicio con la ventana maximizada
            this.WindowState = FormWindowState.Maximized;
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            FormModificarRol form = new FormModificarRol();
            form.idRol = dataGridView1.CurrentRow.Cells["RolId"].Value.ToString();
            form.nombreRol = dataGridView1.CurrentRow.Cells["RolNombre"].Value.ToString();
            form.habilitado = dataGridView1.CurrentRow.Cells["RolHabilitado"].Value.ToString();
            form.ShowDialog(this);
            DataTable DtRoles = RolDAO.FiltrarRoles(rol);
            dataGridView1.DataSource = DtRoles;
        }

    }//fin form
}//fin namespace
